package com.eight.voteServer.impl;

import com.eight.entity.Picture;
import com.eight.voteDao.PictureDao;
import com.eight.voteServer.PictureServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PictureServerImpl implements PictureServer {

    @Autowired
    private PictureDao pictureDao;

    @Override
    public Long pictureCount(){
        return pictureDao.count();
    }

    @Override
    public Page<Picture> findAll(Pageable pageable) {
        return pictureDao.findAll(pageable);
    }

    @Override
    public List<Picture> findAllByList(){
        return pictureDao.findAllByList();
    }

    @Override
    public Picture findByPictureId(int id){return pictureDao.findByPictureId( id );}

    @Override
    public void save(Picture picture){pictureDao.save( picture );}
}
